define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function() {
		this.callParent();
		this.url = "http://yun.jiawoltd.com";
		this.orgId;
	};

	Model.prototype.modelParamsReceive = function(event) {
		if (this.params && this.params.id != undefined) {
			orgId = this.params.id;
		}

		var deviceDdata = this.comp("deviceDdata");
		deviceDdata.clear();
		var sensorData = this.comp("sensorData");
		sensorData.clear();
		var devices;
		$.ajax({
			cache : false,
			type : "GET",
			timeout : 10000, // 超时时间设置，单位毫秒
			url : this.url + "/mobile/getDevice/" + orgId,
			data : {},
			async : false,
			error : function(request) {
			},
			success : function(resp) {
				devices = resp;
				deviceDdata.loadData(resp);
			}
		});
		if (devices && devices.length > 0) {
			for (var i = 0; i < devices.length; i++) {
				if (devices[i].type == '采集器') {
					$.ajax({
						cache : false,
						type : "GET",
						timeout : 10000, // 超时时间设置，单位毫秒
						url : this.url + "/mobile/getSensor/" + devices[i].id,
						data : {},
						async : false,
						error : function(request) {
						},
						success : function(resp) {
							sensorData.loadData(resp, true);
						}
					});
				}
			}
		}
	};

	Model.prototype.scrollView1PullDown = function(event) {
	};

	return Model;
});